<?php

class  LoginController extends BaseController
{
    /**
     *  @desc 初始化服务名称
     */
    protected $serviceName;
    public function init()
    {
        $this->serviceName='login';
    }

    /**
     * @desc 手机号/账号+密码登录
     * @author zhaozhiwei
     * @date 2021-02-04 13:36
     */
    public function apLoginAction()
    {
        $params = (new \validate\Login())->checkAccount();
        $client = self::client($this->serviceName, 'apLogin', $params);
        return \IO\Output::OverSuccess($client);
    }

    /**
     * @desc 手机号+验证码登录(附带新用户注册)
     * @author zhaozhiwei
     * @date 2021-02-04 13:39
     */
    public function mcLoginAction(){
        $params = (new \validate\Login())->gocheck('login_code','post');
        $client = self::client($this->serviceName, 'mcLogin', $params);
        return self::ResInfo($client);       
    }

    /**
     * @desc 发送短信验证码
     * @author zhaozhiwei
     * @date 2021-02-05 8:41
     */
    public function sendCodeAction(){
        $params = (new \validate\Login())->gocheck('mobile','post');
        $client = self::client($this->serviceName, 'sendCode', $params);
        return self::ResInfo($client);
    }

    /**
     * @desc  手机号修改密码
     * @author zhaozhiwei
     * @date 2021-02-05 8:41
     */
    public function changePwdAction(){
        $params = (new \validate\Login())->gocheck('register','post');
        $client = self::client($this->serviceName, 'changePwd', $params);
        return self::ResInfo($client);
    }
}